package com.jumi.microservice.utils;

import com.jumi.microservice.common.constant.RequestConstant;
import org.apache.commons.lang.StringUtils;

import javax.servlet.http.HttpServletRequest;

/**
 * - - - - - - - - - - - - - - -
 *
 * @author liuz
 * @date 2020/7/27 11:46
 * ToDoSomeThing
 * - - - - - - - - - - - - - - -
 */
public class HttpRquestUtil {

    /**
     * 获取用户id
     * @param request
     * @return
     */
    public static Long getUserId(HttpServletRequest request){
        Long uid = 0L;
        if(StringUtils.isNotEmpty(request.getHeader(RequestConstant.ADMIN_ID))){
            uid = Long.parseLong(request.getHeader(RequestConstant.ADMIN_ID));
        }
        return uid;
    }
}
